import Vue from 'vue'
import VueRouter from 'vue-router'
import AdminIndex from '../views/admin/AdminIndex'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'home',
    redirect: '/admin',
  },
  {
    path: '/admin',
    name: 'admin',
    component: AdminIndex,
    children:[
      {
        path:'/admin/product/info',
        component:() => import('../views/admin/product/ProductInfo')
      },
      {
        path:'/admin/product/type',
        component:() => import('../views/admin/product/Type')
      },
      {
        path: '/admin/file/list',
        component:() => import('../views/admin/file/File')
      }
    ]
  },
  {
    path: '/login',
    name: 'login',
    component: () => import('../views/admin/login'),
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
